﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Portal.Filter;
using Portal.Models;
using SoEasyPlatform.LayUiExample.Enties.DbModels;

namespace Portal.Controllers
{
    /// <summary>
    /// 系统配置相关页面路径入口
    /// </summary>
    [LoginCheckFilter(IsCheck = true)]
    public class SysController : Controller
    {
        #region 首页

        public IActionResult Index()
        {
            var loginUserStr = HttpContext.Session.GetString(GlobalVariable.LoginUser);

            if (!string.IsNullOrEmpty(loginUserStr))
            {
                this.ViewBag.LoginUser = JsonConvert.DeserializeObject<sys_user>(HttpContext.Session.GetString(GlobalVariable.LoginUser));
            }

            return View();
        }

        /// <summary>
        /// 修改密码页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToChangePwd()
        {
            var loginUserStr = HttpContext.Session.GetString(GlobalVariable.LoginUser);

            if (!string.IsNullOrEmpty(loginUserStr))
            {
                this.ViewBag.LoginUser = JsonConvert.DeserializeObject<sys_user>(HttpContext.Session.GetString(GlobalVariable.LoginUser));
            }

            return View();
        }

        #endregion

        #region 其他管理


        /// <summary>
        /// 登录日志页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToLoginInfoManager()
        {
            return View();
        }

        /// <summary>
        /// 缓存管理页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToCacheManager()
        {
            return View();
        }

        /// <summary>
        /// 系统通知页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToNoticeManager()
        {
            return View();
        }

        #endregion

        #region 系统管理


        /// <summary>
        /// 部门管理页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToDeptManager()
        {
            return View();
        }

        /// <summary>
        /// 部门管理页面(左页面)
        /// </summary>
        /// <returns></returns>
        public IActionResult ToDeptLeft()
        {
            return View();
        }

        /// <summary>
        /// 部门管理页面(右页面)
        /// </summary>
        /// <returns></returns>
        public IActionResult ToDeptRight()
        {
            return View();
        }
        
        /// <summary>
        /// 菜单管理页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToMenuManager()
        {
            return View();
        }

        /// <summary>
        /// 菜单管理页面(左页面)
        /// </summary>
        /// <returns></returns>
        public IActionResult ToMenuLeft()
        {
            return View();
        }

        /// <summary>
        /// 菜单管理页面(右页面)
        /// </summary>
        /// <returns></returns>
        public IActionResult ToMenuRight()
        {
            return View();
        }


        
        /// <summary>
        /// 用户管理
        /// </summary>
        /// <returns></returns>
        public IActionResult ToUserManager()
        {
            return View();
        }


        /// <summary>
        /// 权限管理页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToPermissionManager()
        {
            return View();
        }

        /// <summary>
        /// 权限管理页面(左页面)
        /// </summary>
        /// <returns></returns>
        public IActionResult ToPermissionLeft()
        {
            return View();
        }

        /// <summary>
        /// 权限管理页面(右页面)
        /// </summary>
        /// <returns></returns>
        public IActionResult ToPermissionRight()
        {
            return View();
        }
       

        
        /// <summary>
        /// 角色管理页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToRoleManager()
        {
            return View();
        }
       

        #endregion
        
        #region 功能案例

        /// <summary>
        /// 文件上传页面
        /// </summary>
        /// <returns></returns>
        public IActionResult ToUploadManager()
        {
            return View();
        }


        public IActionResult ToGdMap(string lnglats, string address, bool anydetailed = true)
        {
            if (string.IsNullOrWhiteSpace(lnglats))
            {
                
                lnglats = "[\"118.376451\", \"31.326319\"]";

            }
            if (string.IsNullOrWhiteSpace(address))
            {
                address = "安徽省芜湖市";
            }

            ViewBag.lnglats = lnglats;
            ViewBag.address = address;
            ViewBag.anydetailed = anydetailed;
            return View();
        }

        
        #endregion

    }
}


